;var module = angular.module('CtrlsContent');
module.controller('Dianti1Ctrl',['$scope','$state','api_other',function($scope,$state,api_other){
	$scope.popShow = false;
	$scope.banner = "images/img/bg_lead01.jpg";
	$scope.event = {
		btn1:function(){
			$scope.popShow = true;
		},
		yihoumai:function(){
			var obj = {
				userId:localStorage.bls_userId,
				catId:localStorage.catId,
				type:2
			};
			var promise = api_other.diantiList(obj);
			promise.success(function(data){
				if(data.returnCode == 0){
					$scope.list = data.returnData;
					if($scope.list.length == 0){
						$scope.popShow=true;
					}else{
						$state.go('diantiyigoumai');
					}
				}else{
					$scope.popShow=true;
				}
			});
		},
		banner:function(){
			var obj = {
				cat_id:localStorage.catId,
				type:2
			};
			var promise = api_other.getBanner(obj);
			promise.success(function(data){
				if(data.returnCode == 0){
					$scope.banner = "http://"+data.returnData.diantiAds;
				}
			})
		}
	};
	$scope.event.banner();
}])